<?php

namespace app\admin\model;

use think\Model;

/**
 * 社群售卖余额表
 * Class ResourceSaleBalance
 * @package app\admin\model
 */
class ResourceSaleBalance extends Model
{
    /**
     * 获取余额
     * @param $where
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function findResourceSaleBalance($where)
    {
        $info = self::where($where)->find();
        return $info ? $info->toArray() : [];
    }

    /**
     * 创建余额
     * @param $data
     * @return ResourceSaleBalance
     */
    public static function createResourceSaleBalance($data)
    {
        return self::create($data);
    }

    /**
     * 更新余额
     * @param $data
     * @param $where
     * @return ResourceSaleBalance
     */
    public static function updateResourceSaleBalance($data, $where)
    {
        return self::update($data, $where);
    }

}